package simple;

import org.apache.commons.collections.list.AbstractLinkedList;
import org.apache.rocketmq.client.consumer.DefaultLitePullConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.message.MessageExt;

import java.util.List;

/**
 * 拉模式-随机获取一个queue消息
 */
public class LitePullConsumer {
    public static void main(String[] args) throws MQClientException {
        DefaultLitePullConsumer consumer =new DefaultLitePullConsumer();
        consumer.setNamesrvAddr("");
        consumer.subscribe("Simple","*");
        consumer.start();
        while (true){
            List<MessageExt> messageExtList = consumer.poll();
            System.out.println("消息拉取成功");
            messageExtList.forEach(n->{
                System.out.println("消息消费成功"+n);
            });
        }
    }
}
